<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>产品分类</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
</head>
<body>
	<div class="container">
        <div class="flow">
            <div class="itemtitle">
                <h3>产品分类</h3>
                <ul>
                    <li <{if $smarty.get.operation==''}>class="current"<{/if}>><a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>"><span>管理</span></a></li>
                   	<li <{if $smarty.get.operation=='add'}>class="current"<{/if}>><a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=add"><span>添加</span></a></li>
                    <{if $smarty.get.operation=='edit'}>
                    <li class="current"><a href="#"><span>修改</span></a></li>
                    <{/if}>
                </ul>
            </div>
        </div>
        <div class="h35"></div>
        <form action="" method="post">
        <{if $smarty.get.operation=='add' or $smarty.get.operation=='edit' }>
            <form name="form" id="form" method="post">
            <input name="id" type="hidden" id="id" value="<{$re.catid}>">
            <table class="table">
                <thead>
                    <tr>
                        <th class="partition" colspan="99">产品分类</th>
                    </tr>
                </thead>
                <tbody>
                
                <tr>
                    <td width="100">分类</td>
                    <td>
                    <select class="ws350" name='pid' >
                    	<option value='0'>顶级类别</option>
                        <{foreach item=list from=$de}>
                        
             			<option <{if $re.cid==$list.catid || $smarty.get.catid==$list.catid}> selected="selected" <{/if}> value="<{$list.catid}>"><{$list.cat}></option>
                           
                            <{foreach item=slist from=$list.scat}>
                            <option <{if $re.cid==$slist.catid || $smarty.get.catid==$slist.catid}> selected="selected" <{/if}> value="<{$slist.catid}>">|__<{$slist.cat}></option>
                            	    
                                    <{foreach item=lists from=$slist.scat}>
                                    <option <{if $re.cid==$lists.catid || $smarty.get.catid==$lists.catid}> selected="selected" <{/if}> value="<{$lists.catid}>">|____<{$lists.cat}></option>
	                                    <{foreach item=slists from=$lists.scat}>
	                                    <option <{if $re.cid==$slists.catid || $smarty.get.catid==$slists.catid}> selected="selected" <{/if}> value="<{$slists.catid}>">|______<{$slists.cat}></option>
	                                    
	                            		<{/foreach}>
                            		<{/foreach}> 
                                    
                            <{/foreach}> 
                            
                        <{/foreach}> 
            		</select>
                    <div id="form-error" class="form-error"></div>
                    </td>
                </tr>
               
                <tr>
                    <td>分类名</td>
                    <td>
                    <{if $smarty.get.operation=='edit'}>
                    <input name="cat" type="text" id="cat" class="w350" value="<{$re.cat}>"/>
                    <{else}>
                    <textarea name="cat" id="cat" class="w350" rows="10"></textarea>
                    <div>可批量添加，每行一个分类</div>
                    <{/if}>
                    <div id="form-error" class="form-error"></div>
                    </td>
                </tr>
                
                <tr>
                    <td>税率</td>
                    <td>
                    <input type="text" id="tax_rate" name="tax_rate"  value="<{$re.tax_rate}>" >
                    </td>
                </tr>
                
                <tr>
                    <td>HSCODE</td>
                    <td>
                    <input type="text" id="hscode" name="hscode"  value="<{$re.hscode}>" >
                    </td>
                </tr>
                
                <tr>
                    <td>完税价</td>
                    <td>
                    <input type="text" id="tax_paid_price" name="tax_paid_price"  value="<{$re.tax_paid_price}>" >
                    </td>
                </tr>
                             
                <tr>
                    <td>&nbsp;</td>
                    <td>
                    <input class="submit" type="submit" value="提交">
                    <input name="act" type="hidden" id="action" value="<{if !$smarty.get.editid}>save<{else}>edit<{/if}>">
                   
                    </td>
                </tr>
                </tbody>
            </table>
            </form>
        <{else}>
        <table class="table">
        	
            <tbody>
                <tr class="header partition">
                    <th width="30"></th>
                    <th width="70">显示顺序</th>
                    <th>分类名称</th>
                    <th width="70">操作</th>
                </tr>
            </tbody>  
              
            <{foreach item=list key=key from=$de}>
            <tbody>
                <tr>
                	<{if $list.scat}>
                	<td onclick="toggle_group('group_<{$list.catid}>')">
                    <a id="a_group_<{$list.catid}>" href="javascript:void(0)"><{if $key>0}>[+]<{else}>[-]<{/if}></a>
                    </td>
                    <{else}><td></td><{/if}>
                    <td><input type="text" class="w50" maxlength="3" name="displayorder[<{$list.catid}>]" value="<{$list.displayorder}>" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td>
                        <input type="text" class="w150" name="name[<{$list.catid}>]" value="<{$list.cat}>" />
                        <a class="addchildboard" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=add&catid=<{$list.catid}>">添加子分类</a>
                    </td>
                    <td>
					<a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=edit&editid=<{$list.catid}>"><{$editimg}></a>
                    <a onclick="return confirm('确定删除吗');" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&delid=<{$list.catid}>"><{$delimg}></a>
                  
                   </td>
                </tr>
            </tbody>
            
            <{if $list.scat}>
            <tbody id="group_<{$list.catid}>" <{if $key>0}>style="display:none;"<{/if}>>
            <{foreach item=slist from=$list.scat}>
                <tr>
                	<td></td>
                	<td><input type="text" class="w50" maxlength="3" name="displayorder[<{$slist.catid}>]" value="<{$slist.displayorder}>" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td><div class="board"><input type="text" class="w150" name="name[<{$slist.catid}>]" value="<{$slist.cat}>" /><a class="addchildboard" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=add&catid=<{$slist.catid}>">添加子分类</a></div></td>
                    <td>
					<a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=edit&editid=<{$slist.catid}>"><{$editimg}></a>
                    <a onclick="return confirm('确定删除吗');" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&delid=<{$slist.catid}>"><{$delimg}></a>
                   </td>
                </tr>
            
			<{foreach item=clist from=$slist.scat}>
				<tr>
                	<td></td>
                	<td><input type="text" class="w50" maxlength="3" name="displayorder[<{$clist.catid}>]" value="<{$clist.displayorder}>" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td><div class="childboard"><input type="text" class="w150" name="name[<{$clist.catid}>]" value="<{$clist.cat}>" /><a class="addchildboard" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=add&catid=<{$clist.catid}>">添加子分类</a></div></td>
                    <td>
					<a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=edit&editid=<{$clist.catid}>"><{$editimg}></a>
                    <a onclick="return confirm('确定删除吗');" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&delid=<{$clist.catid}>"><{$delimg}></a>
                   </td>
                </tr>
             <{foreach item=lists from=$clist.scat}>
				<tr>
                	<td></td>
                	<td><input type="text" class="w50" maxlength="3" name="displayorder[<{$lists.catid}>]" value="<{$lists.displayorder}>" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td><div class="childsboard"><input type="text" class="w150" name="name[<{$lists.catid}>]" value="<{$lists.cat}>" /><a class="addchildboard" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=add&catid=<{$lists.catid}>">添加子分类</a></div></td>
                    <td>
					<a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=edit&editid=<{$lists.catid}>"><{$editimg}></a>
                    <a onclick="return confirm('确定删除吗');" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&delid=<{$lists.catid}>"><{$delimg}></a>
                   </td>
                </tr>
                <{foreach item=slists from=$lists.scat}>
					<tr>
	                	<td></td>
	                	<td><input type="text" class="w50" maxlength="3" name="displayorder[<{$slists.catid}>]" value="<{$slists.displayorder}>" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
	                    <td><div class="lastboard"><input type="text" class="w150" name="name[<{$slists.catid}>]" value="<{$slists.cat}>" /></div></td>
	                    <td>
						<a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=edit&editid=<{$slists.catid}>"><{$editimg}></a>
	                    <a onclick="return confirm('确定删除吗');" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&delid=<{$slists.catid}>"><{$delimg}></a>
	                   </td>
	                </tr>
                <{foreachelse}>
                <{/foreach}>
            <{foreachelse}>
            <{/foreach}>   
            <{foreachelse}>
            <{/foreach}>
            <{foreachelse}>
            <{/foreach}>
            </tbody>
            <{/if}>
            <{foreachelse}>
            <tr>
                <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
            </tr>
            <{/foreach}>
            <tfoot>
                <tr>
                	<td colspan="2">
                        <input type="hidden" name="act" value="op" />
                        <input type="submit" name="submit" value="<{$lang.btn_submit}>" />
                    </td>
                    <td colspan="99"><div class="page"><{$de.page}></div></td>
                </tr>
            </tfoot>
        </table>
        </form>
        <{/if}>
    </div>
</body>
<script>
function toggle_group(oid, conf) {
	obj = $('#a_'+oid)[0];
	if(!conf) {
		var conf = {'show':'[-]','hide':'[+]'};
	}
	var obody = $('#'+oid)[0];
	if(obody.style.display == 'none') {
		obody.style.display = '';
		obj.innerHTML = conf.show;
	} else {
		obody.style.display = 'none';
		obj.innerHTML = conf.hide;
	}
}
</script>
</html>